package com.imooc.distributedemo;

/**
 * question:
 */
public class Demo1 {
    public static void main(String[] args) {
        int[] nums = {1,8,3,2,9,4,6,5,7};
        sort1(nums);
        System.out.println(nums);
    }

    private static void sort1(int[] nums){
        if(null==nums||nums.length<1){
            return;
        }
        int n = nums.length;
        for (int i = 0; i < n-1; i++) {
            for (int j = 0; j < n-i-1; j++) {
                if(nums[j]>nums[j+1]){
                    // swap
                    int tmp = nums[j];
                    nums[j] = nums[j+1];
                    nums[j+1]=tmp;
                }
            }
        }
    }
}
